const mysql = require('mysql')

const con = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: '123456',
  prot: '3306',
  database: 'myblog'
})

con.connect()

let sql = 'SELECT * FROM users'
sql = 'UPDATE users SET realname="李四2" WHERE username="lisi"'
sql = 'INSERT blogs(title, content, createtime, author) VALUE("标题C", "内容C", 1638500115025, "lisi")'
con.query(sql, (err, result) => {
  if (err) {
    console.error(err)
    return
  }
  console.log(result)
})

con.end()
